package com.lin.chapter30.chapter2.builder;

public class Director {
	private CarBuilder benzBuilder = new BenzBuilder();
	private CarBuilder bmwBuilder = new BMWBuilder();

	public ICar createBenzSuv(){
		return this.createCar(benzBuilder, "benz的引擎", "benz的轮胎");
	}

	public ICar createBMMVan(){
		return this.createCar(bmwBuilder, "BMW的引擎", "BWM的轮胎");
	}

	public ICar createComplexCar(){
		return this.createCar(bmwBuilder, "BMW的引擎", "benz的轮胎");
	}

	private ICar createCar(CarBuilder carBuilder, String engine, String wheel){
		BluePrint bluePrint = new BluePrint();
		bluePrint.setEngine(engine);
		bluePrint.setWheel(wheel);
		System.out.println("获得生产南图");
		carBuilder.receiveBlueprint(bluePrint);
		return carBuilder.buildCar();
	}
}
